/*
 * worktask.h
 *
 *  Created on: 2012-5-2
 *      Author: epmm
 */

#ifndef WORKTASK_H_
#define WORKTASK_H_

class CWorkTask
{
	bool m_Block;
	const unsigned int QUEUE_MAX;
	std::deque<CJobBase*> m_Jobs;

	CThreadMutex m_Mutex;
	CThreadCondition m_queue_full_cond; //工作线程创建条件变量
	CThreadCondition m_queue_empty_cond; //工作线程条件变量
public:
	CWorkTask();
	CWorkTask(bool block,int max_queue);
	virtual ~CWorkTask();

	int addJob(CJobBase* pJob); //增加任务
	CJobBase* getJob(); //取出任务
	int getJobsize();
};

#endif /* WORKTASK_H_ */
